1. The Field of the Invention
The present invention relates to methods for calculating dates and times. More specifically, the present invention relates to methods used to calculate dates and times at which events occur within a specified time period based on user defined rules and exceptions.
2. The Prior State of the Art
Computers are becoming commonplace, and they have begun to replace many different everyday items. Word processing programs are replacing typewriters and spreadsheets are used instead of calculators. Similarly, programs capable of maintaining calendaring and scheduling information are replacing daybooks and planners. Calendaring and scheduling programs provide a user with a variety of related applications. Typically, a calendaring application has an address book, means to send and receive email, a journal and a task list, which help users automate their daily responsibilities and activities.
With regard to dates and times, the most important feature of a scheduling program is the calendar. The calendar can be viewed in various modes which may include daily, weekly, monthly or yearly. Many programs allow the user to specify the time window (i.e., a selected number of days, weeks, etc.) that is displayed to the user. For example, each day can be shown on a computer screen, and the user is presented with various options, which may include scheduling an appointment, setting an alarm or making a reminder. Calendar programs often permit a user to add notes or text such that the information is viewed and associated with a particular day and/or time.
It is well known that many appointments or dates occur repeatedly. For example, a business may hold a monthly managerial meeting at a certain place. Using current calendaring technologies, a user would have to manually input all information associated with each monthly meeting into the proper location in the calendar. This technique for scheduling appointments or meetings is not unlike a dayplanner where the user must actually write the information in each appropriate date.
Conventionally, appointments, meetings and related events have been entered into a corresponding calendaring application by physically editing and/or entering each respective event occurrence. The Internet Calendaring and Scheduling Core Object Specification (iCalendar), provides a syntax language for specifying an event definition expression that includes rules and exceptions that define recurring xe2x80x9ceventsxe2x80x9d that would typically be included within a calendar or scheduling-type application. For instance, a user can write an event expression that includes a rule stating that a meeting will occur on the Thursday of the last week of every month. In addition, the user can include within the expression one or more exceptions to the primary rule. For example, the above rule can be modified to exclude those Thursdays that occur in the months of July and November. Furthermore, the user can specify a modify rule. For instance, in the above example, the user could specify that if any of the Thursdays fall on the 27th, then the meeting should instead be held on the previous Thursday.
Although the iCalendar syntax can be used to formulate rules and exceptions that define recurring events, it does not provide methods and systems for processing the rules and exceptions to generate the specific times and dates at which the events occur. In other words, the iCalendar syntax has not been associated with an efficient engine that can be used to convert iCalendar rules and exceptions to times and dates.
In view of the foregoing, there is a need in the art for systems and methods for processing expressions that define recurring events to yield the times and dates associated with the occurrences of the events. It would be advantageous if such systems and methods could process expressions that are written in an iCalendar syntax or any other available format. It would be particularly useful to provide systems and methods for generating the times and dates associated with expressions having any desired level of complexity, including those that impose various conditions on the dates and times of the events and those that have multiple rules, exceptions, and modifications.
The present invention relates to generating times and dates based on an expression defining an event. The invention can be applied to event expressions that have any number or combination of rules, including rule exceptions and modifications. For example, given an expression defining a recurring event, the systems and methods of the invention can be used to generate the specific times and dates on which occurrences of the events fall. The times and dates generated according to the invention can be used by calendar, scheduling, and other applications. Moreover, the methods for generating the times of events efficiently use computer processing and memory resources.
The general process for calculating times and dates is conducted, for example, when a computer user or an application program requests specific times and dates that are defined by the event expression. The event expression, which can be written in the iCalendar syntax or another defined language, includes the rules, rule exceptions and/or rule modifications that define a recurring event or events. A time window is associated with the event expression, and defines the time period in which the times and dates of the event occurrences are to be calculated. For example, the user may specify that the times and dates of the occurrences of the events are to be calculated during a given calendar year.
According to one aspect of the invention, the overall event expression is parsed into individual rules and exceptions that are assigned to one of three groups or categories: (1) rules and exceptions that add one or more event occurrences (an xe2x80x9caddxe2x80x9d rule group); (2) exceptions that modify one or more occurrences (a xe2x80x9cmodifyxe2x80x9d rule group); and (3) exceptions that delete one or more occurrences (a xe2x80x9cdeletexe2x80x9d rule group).
With the rules and exceptions assigned to the foregoing groups, successive occurrences of each rule and exception are calculated. The occurrences can be identified using two cooperating procedures referred to as the xe2x80x9cget-firstxe2x80x9d and xe2x80x9cget-nextxe2x80x9d procedures. In particular, the get-first and get-next procedures compute the time and date of the first occurrence and successive occurrences thereafter for each of the rules and exceptions within the groups. When an event occurrence is calculated, it is placed in a sorting data structure associated with the group (i.e., the add, modify, or delete groups) to which the corresponding rule or exception was assigned. In this manner, the times and dates of event occurrences associated with the rules and exceptions are sorted chronologically and allocated to the three groups.
As the occurrences corresponding to the rules and exceptions are calculated and sorted as described above, they are merged to generate the times and dates defined by the overall event expression. The process of merging involves analyzing the occurrences generated for the add group using priority rules to determine whether the add rule occurrences should be deleted in view of a delete rule occurrence, modified based on a modify rule occurrence, or instead designated as an event occurrence defined by the overall event expression. If an add rule occurrence coincides with a delete rule occurrence, it does not represent the time and date of an event defined by the overall event expression. If the add rule occurrence does not coincide with a delete rule occurrence, but instead coincides with a modify rule occurrence, the modify rule occurrence is designated as an event occurrence defined by the overall event expression. Moreover, if the add rule occurrence does not coincide with a delete rule occurrence or a modify rule occurrence, the add rule occurrence represents an event occurrence defined by the overall event expression.
Generating times and dates occurring in a specified time window and defined by an event expression according to the invention is efficient because the sorting and merging of occurrences is accomplished one-by-one as needed (i.e., occurrences are sorted and merged on the fly), instead of computing and sorting all of the occurrences in the specified time window for each group fully before they are merged together. Thus, the systems and methods of the invention can be implemented in computer systems without consuming significant computing resources.
Additional objects and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the invention. The objects and advantages of the invention may be realized and obtained by means of the instruments and combinations particularly pointed out in the appended claims. These and other objects and features of the present invention will become more fully apparent from the following description and appended claims, or may be learned by the practice of the invention as set forth hereinafter.